<?php

class BookmarksHelper extends AppHelper {
	
	var $helpers = array('Html');
	
	var $socialNetworks = array(
	
	'delicious'=>array('title'=>'Digg This','href'=>'http://digg.com/submit?phase=2&amp;url=[[URL]]'),
	'digg'=>array('title'=>'Del.icio.us','href'=>'http://del.icio.us/post?url=[[URL]]'),
	'facebook'=>array('title'=>'Share on Facebook','href'=>'http://www.facebook.com/sharer.php?u=[[URL]]'),
	'twitter'=>array('title'=>'Twitter','href'=>'http://twitter.com/home?status=Currently reading [[URL]] (via @Beanhunter)" title="Click to send this page to Twitter!" target="_blank"'),

	);
	
	function links()
	{
		$output = '';
		$socialNetworks = func_get_args();
		foreach($socialNetworks as $website)
		{
			if(!isset($this->socialNetworks[$website]))
				break;
			
			$currentNetwork = $this->socialNetworks[$website];
			$title = $currentNetwork['title'];
			$selfUrl = Configure::read('cmsConfig.Backend.siteUrl').'/'.$this->params['url']['url'];
			$href = Utility::replaceTemplateVars($currentNetwork['href'], array('URL'=>$selfUrl));
			$output .= $this->Html->link($title, $href, array('target'=>'_blank'))." | ";
		}
		$output = substr($output, 0, -3);
		return $output;
	}


}
?>